class TripsController < ApplicationController

  def index
    @event = Event.find(params[:event_id])
  end

  def create_arrive
    @arrive = Arrive.new(params[:arrive])
    event = Event.find(params[:event])
    @arrive.event=event;
    @arrive.save
#    render :update do |page|
#      page.create(:arrive,@arrive)
#    end
  end

  def create_revert
    @revert = Revert.new(params[:revert])
    event=Event.find(params[:event])
    @revert.event = event;
    @revert.save
#    render :update do |page|
#      page.create(:revert,@revert)
#    end
  end

  def delete
    trip = Trip.find(params[:id])
    del(trip)
  end

 private
  def del(obj)
    if obj.destroy
      render :update do |page|
        page.remove("#{obj.id}")
      end
    end
  end
end
